﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Data.Linq.Mapping;
using System.ComponentModel;

namespace STS.Model
{
    [Table]
    public class Organ : INotifyPropertyChanged, INotifyPropertyChanging
    {
        private int id;

        [Column(IsPrimaryKey = true, IsDbGenerated = true, DbType = "INT NOT NULL Identity", CanBeNull = false, AutoSync = AutoSync.OnInsert)]
        public int Id
        {
            get { return id; }
            set
            {
                if (id != value)
                {
                    NotifyPropertyChanging("Id");
                    id = value;
                    NotifyPropertyChanged("Id");
                }
            }
        }

        private int idOrganu;

        [Column]
        public int IdOrganu
        {
            get { return idOrganu; }
            set
            {
                if (idOrganu != value)
                {
                    NotifyPropertyChanging("IdOrganu");
                    idOrganu = value;
                    NotifyPropertyChanged("IdOrganu");
                }
            }
        }

        private string typ;

        [Column]
        public string Typ
        {
            get { return typ; }
            set
            {
                if (typ != value)
                {
                    NotifyPropertyChanging("Typ");
                    typ = value;
                    NotifyPropertyChanged("Typ");
                }
            }
        }

        private string grupaKrwi;

        [Column]
        public string GrupaKrwi
        {
            get { return grupaKrwi; }
            set
            {
                if (grupaKrwi != value)
                {
                    NotifyPropertyChanging("GrupaKrwi");
                    grupaKrwi = value;
                    NotifyPropertyChanged("GrupaKrwi");
                }
            }
        }

        private int wiek;

        [Column]
        public int Wiek
        {
            get { return wiek; }
            set
            {
                if (wiek != value)
                {
                    NotifyPropertyChanging("Wiek");
                    wiek = value;
                    NotifyPropertyChanged("Wiek");
                }
            }
        }

        private string tkanki;

        [Column]
        public string Tkanki
        {
            get { return tkanki; }
            set
            {
                if (tkanki != value)
                {
                    NotifyPropertyChanging("Tkanki");
                    tkanki = value;
                    NotifyPropertyChanged("Tkanki");
                }
            }
        }

        private int idOsrodka;

        [Column]
        public int IdOsrodka
        {
            get { return idOsrodka; }
            set
            {
                if (idOsrodka != value)
                {
                    NotifyPropertyChanging("IdOsrodka");
                    idOsrodka = value;
                    NotifyPropertyChanged("IdOsrodka");
                }
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        public event PropertyChangingEventHandler PropertyChanging;

        private void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        private void NotifyPropertyChanging(string propertyName)
        {
            if (PropertyChanging != null)
            {
                PropertyChanging(this, new PropertyChangingEventArgs(propertyName));
            }
        }

        public override string ToString()
        {
            return String.Format("Id: {0} Nazwa: {1} IdTypLekarza: {2}", Id, Typ, IdOrganu);
        }
    }
}
